<!doctype html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户重设密码页|私教预约系统</title>
    <link rel="shortcut icon" type="image/x-icon" href="../favicon.ico" />
    <link rel="stylesheet" type="text/css" href="../css/normalize.css" />
    <link rel="stylesheet" type="text/css" href="../css/default.css">
    <link rel="stylesheet" type="text/css" href="../css/styles.css">
    <link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" href="../css/materialdesignicons.min.css" />
    <link rel="stylesheet" type="text/css" href="../css/style.min.css" />
    <link href="../css/coming-soon.min.css" rel="stylesheet">

</head>
<body>

<div class="overlay"></div>
<video playsinline="playsinline" autoplay="autoplay" muted="muted" loop="loop">
    <source src="../mp4/exercise.mp4" type="video/mp4">
</video>

<div class="masthead">
    <div class="container h-100">
        <div class="row h-100">
            <div class="col-12 my-auto">
                <div class="masthead-content text-white py-5 py-md-0">
                    <p></p>
                    <div class="htmleaf-container">
                        <div class="login-wrap">
                            <div class="login-html">
                                <input id="tab-1" type="radio" name="tab" class="sign-in" checked><label for="tab-1" class="tab">重置密码</label>
                                <input id="tab-2" type="radio" name="tab" class="sign-up"><label for="tab-2" class="tab"></label>
                                <div class="login-form">
                                    <div class="sign-in-htm">
                                        <div class="group">
                                            <label for="user_in" class="label">用户名</label>
                                            <input id="user_in" type="text" class="input" >
                                        </div>
                                        <div class="group">
                                            <label for="phone_in" class="label">手机号</label>
                                            <input id="phone_in" type="text" class="input" >
                                        </div>
                                        <div class="group">
                                            <label for="pass_in" class="label">密码</label>
                                            <input id="pass_in" type="password" class="input" data-type="password">
                                        </div>
                                        <div class="group">
                                            <label for="pass_again" class="label">重复密码</label>
                                            <input id="pass_again" type="password" class="input" data-type="password">
                                        </div>
                                        <div class="group">
                                            <input id="check" type="checkbox" class="check" checked>
                                            <label for="check"><span class="icon"></span> 保存密码</label>
                                        </div>
                                        <div class="group">
                                            <input id="signin" type="submit" class="button" value="登录">
                                        </div>
                                        <div class="hr"></div>
                                        <div class="foot-lnk">
                                            <a href="/pages/pwdReset.html" class="forget-pwd">忘记密码？</a>
                                        </div>
                                    </div>
                                    <div class="sign-up-htm">
                                        <div class="group">
                                            <label for="user_up" class="label">用户名</label>
                                            <input id="user_up" type="text" class="input">
                                        </div>
                                        <div class="group">
                                            <label for="pass_up" class="label">密码</label>
                                            <input id="pass_up" minlength="6" required type="password" class="input" data-type="password">
                                        </div>
                                        <div class="group">
                                            <label for="pass_a" class="label">重复密码</label>
                                            <input id="pass_a" type="password" class="input" data-type="password">
                                        </div>
                                        <!--<div class="group">
                                            <label for="pass_e" class="label">Email Address</label>
                                            <input id="pass_e" type="text" class="input">
                                        </div>-->
                                        <div class="group">
                                            <input id="signup" type="submit" class="button" value="注册">
                                        </div>
                                        <div class="hr"></div>
                                        <div class="foot-lnk">
                                            <label for="tab-1">Already Member?</label>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


</body>
<script src="../js/jquery.min.js"></script>
<script src="https://cdn.staticfile.org/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
<script type="text/javascript">
    jQuery(document).ready(function(){
        jQuery("#signin").click(function () {
            let name = jQuery("#user_in").val();
            let phone = jQuery("#phone_in").val();
            let pwd = jQuery("#pass_in").val();
            let pwdA = jQuery("#pass_again").val();

            jQuery.post("/getUserInfoByName", {"userName": name}, function(rst){
                if (rst.userPhone == phone){
                    if (pwd == pwdA){
                        jQuery.post("/updateUserPwd", {"userName": name, "newPassword": pwd}, function (rst){
                            if(rst){
                                alert("修改密码成功");
                                window.location.replace("usersSign.html");
                            }else{
                                alert("修改密码失败");
                            }
                        })
                    }else{
                        alert("重复密码错误！！！");
                    }
                }else{
                    alert("手机号错误或用户名不存在");
                }

            })

        })
    });







</script>
</html>